﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SISGEZATBZVisual.BusinessEntities;

namespace SISGEZATBZVisual.Repository.Mapping
{
    public class NotaFinalMap:EntityTypeConfiguration<NotaFinal>
    {
        public NotaFinalMap()
        {
            this.HasKey(c => new { c.IdAlumno, c.IdCurso });
         

            //propiedades
      

            this.Property(r => r.NotaFinalLetra)
                .IsRequired().HasMaxLength(5);

            this.Property(r => r.NotaFinalNumero)
               .IsRequired();


            //table
            this.ToTable("NotaFinal");

            //Relaciones
            this.HasRequired(r => r.Alumno)
                .WithMany()
                .HasForeignKey(r => r.IdAlumno)
                .WillCascadeOnDelete(false);
         
               this.HasRequired(c => c.Curso)
                   .WithMany()
                    .HasForeignKey(c => c.IdCurso)
                    .WillCascadeOnDelete(false);

        }
    }
}
